package com.zhanghaijun.createCode.jdk.date;

import com.zhanghaijun.createCode.util.DateUtil;
import com.zhanghaijun.createCode.util.PrintUtil;
import org.junit.Test;

import java.util.Date;

/**
 * Created by zhanghaijun on 15/8/18.
 */
public class DateTestDemo {


    @Test
    public void testGetTwoStringDate(){
        String begin ="20120508";
        String end ="20120513";
        Date beginDate = DateUtil.strToDate(begin,"yyyyMMdd");
        Date endDate = DateUtil.strToDate(end,"yyyyMMdd");
        for(Date i =beginDate;i.getTime()<=endDate.getTime();i=DateUtil.addDays(i,1)){
            PrintUtil.println(DateUtil.dateToString(i,"yyyyMMdd"));
        }
    }

}
